package com.ityj.yygh.oss.controller;

import com.ityj.yygh.oss.service.FileService;
import com.ityj.yygh.result.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(value = "文件上传接口")
@RestController
@RequestMapping(path = "/api/oss")
public class FileUploadApiController {

    @Autowired
    private FileService fileService;

    @PostMapping(path = "/uploadFile")
    public Result uploadFile(MultipartFile multipartFile) {
        String fileUrl = fileService.uploadFile(multipartFile);
        return Result.ok(fileUrl);
    }

}
